home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr49 / vesa18.zip / MOUSTEST.C < prev    next >
C/C++ Source or Header  |  1994-04-18  |  1KB  |  45 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4.  
  5. #include "vesa.h"
  6.  
  7. void main(int argc, char *argv[])
  8. {
  9.   VESAWORD x, y, status;
  10.   VESACHAR c;
  11.  
  12.   if (argc != 3)
  13.     {
  14.       printf("Usage: moustest <mode-number> <wait flag>\n");
  15.       printf("       where <wait flag> is - 0: do not wait for mouse events\n");
  16.       printf("                            - 1: wait for mouse events\n");
  17.       return;
  18.     }
  19.   if (!VesaSetMode(atoi(argv[1])))
  20.     {
  21.       VesaSetMode(3);
  22.       printf("Could not activate mode 0x%x", atoi(argv[1]));
  23.       return;
  24.     }
  25.   if (!MouseOpen())
  26.     {
  27.       VesaSetMode(3);
  28.       printf("Could not initialize mouse.\n");
  29.       return;
  30.     }
  31.   MouseShow();
  32.   do
  33.     {
  34.       if (MouseGetEvent(&x, &y, &status, atoi(argv[2])))
  35.         printf("  ");
  36.       else
  37.         printf("No");
  38.       printf(" Mouse Event: x = %i, y = %i, status = %i (press any key, ESC to abort)\n", x, y, status);
  39.       VesaGetCharacter(&c);
  40.     }
  41.   while (c != 0x1b);
  42.   MouseHide();
  43.   MouseClose();
  44. }
  45.